/*
 * @Author:洪智豪(pepsi)
 * @description: 增删改查浏览器本地存储
 * @save 存储   db.save(key 键, value 值)
 * @get  读取   db.get(key 键, default 返回的默认值)
 *
 */
export function save(key, value){
  localStorage.setItem('PETS' + "_" + key, JSON.stringify(value))
}

export function get(key, defaultValue = {}){
  try {
    return JSON.parse(localStorage.getItem('PETS' + "_" + key)) || defaultValue
  } catch (err) {
    return defaultValue
  }
}
